#include<iostream>
#include<string>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>

std::string terminal = "/dev/pts/3";//第4个终端,命令行为tty

int openTerminal(){
    int fd = open(terminal.c_str(), O_WRONLY);
    if(fd < 0){
        std::cerr <<" open terminal error" <<std::endl;
        return 1;
    }
    dup2(fd,2);//标准错误输出重定位，将错误发送到新终端fd
    return 0;
}
